package com.naiterui.ehp.bs.esign.service;

import java.util.List;

import com.naiterui.ehp.bp.bo.esign.DigitalCertificateBO;
import com.naiterui.ehp.bp.bo.esign.EsignDoctorBO;
import com.naiterui.ehp.bp.bo.esign.EsignNoSecretBO;
import com.naiterui.ehp.bp.bo.esign.NoSecretParamBO;
import com.naiterui.ehp.bp.bo.esign.PreSignResultBO;
import com.naiterui.ehp.bp.bo.esign.WillTypeBO;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.esign.api.bjca.vo.SignUserParamVO;
import com.naiterui.ehp.bs.esign.api.vo.SignAccountVO;
import com.naiterui.ehp.bs.esign.entity.mysql.EsignDoctor;

/**
 * @Description 医生业务接口
 * @Author gongbaoqiang
 * @Date 2019/12/30 5:51 PM
 */
public interface IDoctorService {

    /**
     * 医生签名用户注册
     *
     * @param userParamVO
     *
     * @return
     */
    EsignDoctor addUserDr(SignUserParamVO userParamVO) throws BusinessException;

    /**
     * 更新手机号
     * @param doctorId
     * @param phone
     * @throws BusinessException
     */
    void updatePhone(Long doctorId, String phone) throws BusinessException;

    /**
     * <pre>
     *     发起运营商3要素核身
     *     获取实名认证验证码
     * </pre>
     * @param name 姓名
     * @param phone 手机号
     * @param idCard 身份证号
     * @return
     * @throws BusinessException
     */
    String getRealnameCode(String name , String phone, String idCard) throws BusinessException;

    /**
     * <pre>
     *     校验三要素短信验证码
     *     回写实名认证状态
     * </pre>
     * @param phone
     * @param code
     * @throws BusinessException
     */
    boolean checkRealname(String phone, String code) throws BusinessException;


    /**
     * 医生签名账户信息
     * @param doctorId
     * @return
     * @throws BusinessException
     */
    EsignDoctorBO getEsignInfo(Long doctorId) throws BusinessException;

    /**
     * 获取意愿签署方式列表
     * @return
     * @throws BusinessException
     */
    List<WillTypeBO> getWillTypes(Long doctorId) throws BusinessException;

    /**
     * 更新意愿签署方式
     * @param doctorId
     * @param willType
     * @throws BusinessException
     */
    void updateWillType(Long doctorId, String willType) throws BusinessException;

    /**
     * 更新签名密码
     * @param doctorId
     * @param password
     * @throws BusinessException
     */
    void updateSignPassword(Long doctorId, String password) throws BusinessException;

    /**
     * 获取医师签名账号
     * @return
     * @throws BusinessException
     */
    SignAccountVO getSignAccount(Long doctorId, String unionId) throws BusinessException;

    /**
     * 获取是否设置了免密
     * @param doctorId
     * @return
     * @throws BusinessException
     */
    Integer getNoSecretByDoctorId(Long doctorId) throws BusinessException;

    /**
     * 获取免密信息
     * @param doctorId
     * @return
     * @throws BusinessException
     */
    EsignNoSecretBO getEsignNoSecretByDoctorId(Long doctorId) throws BusinessException;

    /**
     * 免签预签署
     *
     * @param doctorId
     * @return
     * @throws BusinessException
     */
    PreSignResultBO preNoSecret(Long doctorId) throws BusinessException;

    /**
     * 设置免密
     * 
     * @param paramBO
     * @return
     * @throws BusinessException
     */
    void setNoSecret(NoSecretParamBO paramBO) throws BusinessException;

    /**
     * 更新签名用户签章图
     * @param doctorId
     * @param sealImgPath
     * @throws BusinessException
     */
    void saveSealImg(Long doctorId, String sealImgPath) throws BusinessException;

    /**
     * 更新esign认证状态
     * @param doctorId
     * @param status
     */
    void setAuthStatus(Long doctorId, Integer status);

    /**
     * 获取用户是否注册过ca账户
     * @param doctorId
     * @param number
     * @return
     */
    Boolean getSignAccountByDoctorIdAndIdNo(Long doctorId, String number);

    /**
     * 查看数字证书
     * 
     * @param doctorId
     * @return
     * @throws BusinessException
     */
    DigitalCertificateBO getDigitalCertificate(Long doctorId) throws BusinessException;

    /**
     * 根据身份证号和认证状态查询医生电子签名账户
     * @param idNo
     * @param authStatus
     * @return
     */
    EsignDoctorBO getAccountByIdNoAndAuthStatus(String idNo, Integer authStatus);

    /**
     * 检查该医生身份证号是否已实名
     * 
     * @param idCard
     * @throws BusinessException
     */
    void checkDoctorRealname(String idCard) throws BusinessException;
}
